﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace dotServer
{
	internal static class Global
	{
		/// <summary>
		/// ホームディレクトリ
		/// </summary>
		static public string HOME_DIR;


		/// <summary>
		/// グローバル変数の初期化
		/// </summary>
		static internal void init ()
		{
			//	環境変数“HOME_DIR”を得る
			HOME_DIR = Environment.GetEnvironmentVariable( "HOME_DIR" );
			if ( HOME_DIR==null || HOME_DIR.Length==0 )
			{
				DirectoryInfo di = new DirectoryInfo( Environment.CurrentDirectory );
				while ( !di.Name.Equals( "bin" ) )
				{
					di = di.Parent;
				}
				HOME_DIR = di.Parent.FullName;
			}
			if ( HOME_DIR.Length==0 ) HOME_DIR = "/";
			if ( HOME_DIR[HOME_DIR.Length-1] != '/' ) HOME_DIR += "/";
		}

	}
}
